<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
        content="width=device-width, initial-scale=1.0">
<meta name="HandheldFriendly" content="true">
<title>Sample</title>
</head>
<body>
<form action="anotherPage.asp" method="get">
  <input name="myName" id="myName" type="text"
    onblur="javascript:oStorage.myNameValue=this.value;"/>
  <input name="mySubmit" type="submit" />
</form>
<script>
try{
  // 获得我们要跟踪的那个文本框
  var oField = document.getElementById("myName");
  var oStorage = window.sessionStorage;
  // 看看我们是否有一个myNameValue键
  if (oStorage.myNameValue) {
      // 如果存在就恢复文本字段中的内容
      oField.value = oStorage.myNameValue;
  }
}catch(err){
  alert(err.message?err.message:err.toString());
}
</script>
</body>
</html>
